import http from '@/util/request.js'

export default {
    // 根据id获取支付记录信息
    getPaymentById(id) {
        return http({
            url: `/api/order/payment/${id}`,
            method: 'get'
        })
    },

    // 根据用户id获取支付记录列表
    getPaymentsByUserId(userId) {
        return http({
            url: `/api/order/payment/user/${userId}`,
            method: 'get'
        })
    },

    // 根据秒杀商品id获取支付记录列表
    getPaymentsBySeckillGoodsId(seckillGoodsId) {
        return http({
            url: `/api/order/payment/seckillgoods/${seckillGoodsId}`,
            method: 'get'
        })
    },

    // 根据商品id获取支付记录列表
    getPaymentsByGoodsId(goodsId) {
        return http({
            url: `/api/order/payment/goods/${goodsId}`,
            method: 'get'
        })
    },

    // 添加支付记录
    addPayment(payment) {
        return http({
            url: '/api/order/payment/add',
            method: 'post',
            data: payment
        })
    },

    // 更新支付记录
    updatePayment(payment) {
        return http({
            url: '/api/order/payment/update',
            method: 'put',
            data: payment
        })
    },

    // 删除支付记录（软删除）
    deletePayment(id) {
        return http({
            url: `/api/order/payment/delete/${id}`,
            method: 'delete'
        })
    },

    // 获取支付记录列表
    getPaymentList(payment) {
        return http({
            url: '/api/order/payment/list',
            method: 'get',
            params: payment
        })
    },

    // 获取支付记录分页列表
    getPaymentPage(payment, current, size) {
        return http({
            url: '/api/order/payment/page',
            method: 'get',
            params: {
                ...payment,
                current,
                size
            }
        })
    }
}
